/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.mx.saco.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author jethro.gutierrez
 */
@Entity
@Table(name = "tt_pagina_xhtml")
@NamedQueries({
    @NamedQuery(name = "PaginaXhtml.findAll", query = "SELECT p FROM PaginaXhtml p"),
    @NamedQuery(name = "PaginaXhtml.findByIdPagina", query = "SELECT p FROM PaginaXhtml p WHERE p.idPagina = :idPagina"),
    @NamedQuery(name = "PaginaXhtml.findByPValue", query = "SELECT p FROM PaginaXhtml p WHERE p.value = :pValue"),
    @NamedQuery(name = "PaginaXhtml.findByPIcon", query = "SELECT p FROM PaginaXhtml p WHERE p.icon = :pIcon"),
    @NamedQuery(name = "PaginaXhtml.findByPCommand", query = "SELECT p FROM PaginaXhtml p WHERE p.command = :pCommand"),
    @NamedQuery(name = "PaginaXhtml.findByPRendered", query = "SELECT p FROM PaginaXhtml p WHERE p.rendered = :pRendered"),
    @NamedQuery(name = "PaginaXhtml.findByPId", query = "SELECT p FROM PaginaXhtml p WHERE p.id = :pId")})
public class PaginaXhtml implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_pagina")
    private Integer idPagina;
    @Column(name = "p_value")
    private String value;
    @Column(name = "p_icon")
    private String icon;
    @Column(name = "p_update")
    private String update;
    @Column(name = "p_command")
    private String command;
    @Column(name = "p_rendered")
    private Integer rendered;
    @Column(name = "p_id")
    private String id;
    @ManyToMany(mappedBy = "paginaXhtmlList")
    private List<Usuario> usuarioList;
    
    @JoinColumn(name = "id_pagina_padre", referencedColumnName = "id_pagina_padre")
    @ManyToOne
    private PaginaXhtmlPadre idPaginaPadre;

    public PaginaXhtml() {
    }

    public PaginaXhtml(Integer idPagina) {
        this.idPagina = idPagina;
    }

    public Integer getIdPagina() {
        return idPagina;
    }

    public void setIdPagina(Integer idPagina) {
        this.idPagina = idPagina;
    }

   
    public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public String getIcon() {
		return icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	public String getUpdate() {
		return update;
	}

	public void setUpdate(String update) {
		this.update = update;
	}

	public String getCommand() {
		return command;
	}

	public void setCommand(String command) {
		this.command = command;
	}

	public Integer getRendered() {
		return rendered;
	}

	public void setRendered(Integer rendered) {
		this.rendered = rendered;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public List<Usuario> getUsuarioList() {
        return usuarioList;
    }

    public void setUsuarioList(List<Usuario> usuarioList) {
        this.usuarioList = usuarioList;
    }

    public PaginaXhtmlPadre getIdPaginaPadre() {
        return idPaginaPadre;
    }

    public void setIdPaginaPadre(PaginaXhtmlPadre idPaginaPadre) {
        this.idPaginaPadre = idPaginaPadre;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idPagina != null ? idPagina.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PaginaXhtml)) {
            return false;
        }
        PaginaXhtml other = (PaginaXhtml) object;
        if ((this.idPagina == null && other.idPagina != null) || (this.idPagina != null && !this.idPagina.equals(other.idPagina))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.mx.saco.entity.PaginaXhtml[ idPagina=" + idPagina + " ]";
    }
    
}
